import { DownOutlined } from '@ant-design/icons';
import { Tree } from 'antd';
import { useComponentsStore } from '../../stores/components';
export default function Outline() {
  const {components,setCurComponentId} =useComponentsStore()
  return (
    <Tree
      showLine
      switcherIcon={<DownOutlined />}
      defaultExpandAll
      treeData={components as any}
      fieldNames={//自定义节点，将节点值改为components拥有的
        {
          title:'desc',
          key:'id'
        }
      }
      onSelect={([selectedKeys])=>{//将数组内的值进行解构
        setCurComponentId(selectedKeys as number)
      }}
    />
  );
};

